/*     */ package handling.channel.handler;
/*     */
/*     */ import client.MapleCharacter;
/*     */ import client.MapleClient;
/*     */ import client.MapleQuestStatus;
/*     */ import client.skills.Skill;
/*     */ import client.skills.SkillFactory;
/*     */ import constants.GameConstants;
/*     */ import constants.JobConstants;
/*     */ import constants.ServerConstants;
/*     */ import constants.skills.剑豪;
import handling.Auction.AuctionServer;
/*     */ import handling.ServerType;
/*     */ import handling.cashshop.CashShopServer;
/*     */ import handling.cashshop.handler.CashShopOperation;
/*     */ import handling.channel.ChannelServer;
/*     */ import handling.login.LoginServer;
/*     */ import handling.world.CharacterIdChannelPair;
/*     */ import handling.world.CharacterTransfer;
/*     */ import handling.world.PartyOperation;
/*     */ import handling.world.PlayerBuffStorage;
/*     */ import handling.world.World;
/*     */ import handling.world.WorldAllianceService;
/*     */ import handling.world.WorldBuddyService;
/*     */ import handling.world.WorldFamilyService;
/*     */ import handling.world.WorldFindService;
/*     */ import handling.world.WorldGuildService;
/*     */ import handling.world.WorldMessengerService;
/*     */ import handling.world.WorldPartyService;
/*     */ import handling.world.guild.MapleGuild;
/*     */ import handling.world.messenger.MapleMessenger;
/*     */ import handling.world.messenger.MapleMessengerCharacter;
/*     */ import handling.world.party.MapleExpedition;
/*     */ import handling.world.party.MapleParty;
/*     */ import handling.world.party.MaplePartyCharacter;
/*     */ import java.io.IOException;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.*;
/*     */
/*     */
/*     */
/*     */ import org.apache.logging.log4j.LogManager;
/*     */ import org.apache.logging.log4j.Logger;
/*     */ import scripting.npc.NPCScriptManager;
/*     */ import server.maps.FieldLimitType;
/*     */ import server.quest.MapleQuest;
/*     */ import server.reward.StarReward;
/*     */ import tools.MaplePacketCreator;
/*     */ import tools.Quadruple;
/*     */ import tools.StringUtil;
/*     */ import tools.data.input.LittleEndianAccessor;
/*     */ import tools.packet.BuddyListPacket;
/*     */ import tools.packet.BuffPacket;
/*     */ import tools.packet.FamiliarPacket;
/*     */ import tools.packet.FamilyPacket;
/*     */ import tools.packet.GuildPacket;
/*     */ import tools.packet.InventoryPacket;
/*     */ import tools.packet.LoginPacket;
/*     */ import tools.packet.PartyPacket;
/*     */ import tools.packet.RewardPacket;
/*     */ import tools.packet.SigninPacket;
/*     */ import tools.packet.UIPacket;
/*     */
/*     */ public class InterServerHandler {
    /*  48 */   private static final Logger log = LogManager.getLogger(InterServerHandler.class.getName());
    /*     */
    /*     */   public static void EnterMTS(MapleClient c, MapleCharacter chr) {
        /*  51 */     if (chr.hasBlockedInventory() || chr.getMap() == null || chr.getEventInstance() != null || c.getChannelServer() == null) {
            /*  52 */       c.announce(MaplePacketCreator.serverBlocked(5));
            /*  53 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /*  56 */     if (chr.getMapId() == 180000001 || ServerConstants.isBlockedMapFM(chr.getMapId())) {
            /*  57 */       chr.dropMessage(1, "在这个地方无法使用此功能.");
            /*  58 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /*  61 */     if (chr.isBanned()) {
            /*  62 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /*  65 */     if (chr.getAntiMacro().inProgress()) {
            /*  66 */       chr.dropMessage(5, "被使用测谎仪时无法操作。");
            /*  67 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /*  70 */     NPCScriptManager.getInstance().dispose(c);
        /*  71 */     NPCScriptManager.getInstance().start(c, ServerConstants.getMTSNpcID(), ServerConstants.getMTSNpcID_Mode());
        /*  72 */     c.announce(MaplePacketCreator.enableActions());
        /*     */   }
    /*     */
    /*     */   public static void enterCS(MapleClient c, MapleCharacter chr, boolean script) {
        /*  76 */     enterCS(c, chr, script, true);
        /*     */   }
    /*     */
    /*     */   public static void enterCS(MapleClient c, MapleCharacter chr, boolean script, boolean CS) {
        /*  80 */     if (CS &&
                /*  81 */       !script && ServerConstants.getCSNpcID() != 0) {
            /*  82 */       NPCScriptManager.getInstance().dispose(c);
            /*  83 */       NPCScriptManager.getInstance().start(c, ServerConstants.getCSNpcID(), ServerConstants.getCSNpcID_Mode());
            /*  84 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /*  89 */     if (!chr.isAlive() || chr.isInJailMap() || chr.isBanned() || chr.getAntiMacro().inProgress()) {
            /*  90 */       String msg = "无法进入" + (CS ? "商城" : "拍卖") + "，请稍后再试。";
            /*  91 */       if (!chr.isAlive()) {
                /*  92 */         msg = "现在不能进入" + (CS ? "商城" : "拍卖") + ".";
                /*  93 */       } else if (chr.isInJailMap()) {
                /*  94 */         msg = "在这个地方无法使用次功能.";
                /*  95 */       } else if (chr.getAntiMacro().inProgress()) {
                /*  96 */         msg = "被使用测谎仪时无法操作。";
                /*     */       }
            /*  98 */       c.getPlayer().dropMessage(1, msg);
            /*  99 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /* 102 */     boolean isCheckTime = false;
        /* 103 */     if (isCheckTime && !chr.isAdmin()) {
            /* 105 */       long time = chr.getCheatTracker().getLastlogonTime();
            /* 106 */       if (time + 180000L > System.currentTimeMillis()) {
                /* 107 */         int seconds = (int)((time + 180000L - System.currentTimeMillis()) / 1000L);
                /* 108 */         chr.dropMessage(1, "暂时无法进入" + (CS ? "商城" : "拍卖") + ".\r\n请在 " + seconds + " 秒后在进行操作.");
                /* 109 */         chr.dropMessage(5, "暂时无法进入" + (CS ? "商城" : "拍卖") + ".请在 " + seconds + " 秒后在进行操作.");
                /* 110 */         c.announce(MaplePacketCreator.enableActions());
                /*     */         return;
                /*     */       }
            /*     */     }
        /* 114 */     ChannelServer ch = ChannelServer.getInstance(c.getChannel());
        /* 115 */     chr.changeRemoval();
        /* 116 */     if (chr.getMessenger() != null) {
            /* 117 */       MapleMessengerCharacter messengerplayer = new MapleMessengerCharacter(chr);
            /* 118 */       WorldMessengerService.getInstance().leaveMessenger(chr.getMessenger().getId(), messengerplayer);
            /*     */     }
        /* 120 */     if (CS)
            /* 121 */       chr.updataEnterShop(true);
        /* 123 */     chr.updateTodayDate();
        /* 124 */     PlayerBuffStorage.addBuffsToStorage(chr.getId(), chr.getAllBuffs());
        /* 125 */     PlayerBuffStorage.addCooldownsToStorage(chr.getId(), chr.getCooldowns());
        /* 126 */     PlayerBuffStorage.addDiseaseToStorage(chr.getId(), chr.getAllDiseases());
        /* 127 */     World.ChannelChange_Data(new CharacterTransfer(chr), chr.getId(), CS ? -10 : -20);
        /* 128 */     ch.removePlayer(chr);
        /* 129 */     c.updateLoginState(3, c.getSessionIPAddress());
        /* 131 */     chr.saveToDB(false, false);
        /* 132 */     chr.getMap().removePlayer(chr);
        /* 133 */     c.announce(MaplePacketCreator.getChannelChange(c, CS ? CashShopServer.getPort() : AuctionServer.getPort()));
        /* 134 */     c.setPlayer(null);
        /* 135 */     c.setReceiving(false);
        /*     */   }
    /*     */
    /*     */   public static void Loggedin(LittleEndianAccessor slea, int playerid, MapleClient c, ServerType type) {
        int[] bytes = new int[16];

        for(int i = 0; i < bytes.length; ++i) {
            bytes[i] = slea.readByteAsInt();
        }

        CharacterTransfer transfer = null;

        try {
            if (type.equals(ServerType.商城服务器)) {
                transfer = CashShopServer.getPlayerStorage().getPendingCharacter(playerid);
            } else if (type.equals(ServerType.拍卖服务器)) {
                transfer = AuctionServer.getPlayerStorage().getPendingCharacter(playerid);
            }
        } catch (IOException var26) {
            log.error("读取临时角色失败", var26);
        }

        if (type.equals(ServerType.拍卖服务器)) {
            if (transfer != null) {
                c.初始化DesKey(bytes, playerid);
                CashShopOperation.EnterCS(transfer, c, false);
            }

        } else if (type.equals(ServerType.商城服务器)) {
            if (transfer != null) {
                c.初始化DesKey(bytes, playerid);
                CashShopOperation.EnterCS(transfer, c, true);
            }

        } else {
            Iterator var6 = ChannelServer.getAllInstances().iterator();

            while(var6.hasNext()) {
                ChannelServer cserv = (ChannelServer)var6.next();

                try {
                    transfer = cserv.getPlayerStorage().getPendingCharacter(playerid);
                } catch (IOException var25) {
                    log.error("读取临时角色失败", var25);
                }

                if (transfer != null) {
                    c.setChannel(cserv.getChannel());
                    break;
                }
            }

            StringBuilder sps = new StringBuilder();
            int[] var8 = bytes;
            int var9 = bytes.length;

            for(int var10 = 0; var10 < var9; ++var10) {
                int aByte = var8[var10];
                sps.append(StringUtil.getLeftPaddedStr(Integer.toHexString(aByte).toUpperCase(), '0', 2));
                sps.append("-");
            }

            String macData = sps.toString();
            macData = macData.substring(0, macData.length() - 1);
            boolean firstLoggedIn = true;
            MapleCharacter player;
            if (transfer == null) {
                Quadruple ip = LoginServer.getLoginAuth(playerid);
                String s = c.getSessionIPAddress();
                if (ip == null || !s.substring(s.indexOf(47) + 1, s.length()).equals(ip.one) && !c.getMac().equals(macData)) {
                    if (ip == null) {
                        c.getSession().close();
                        return;
                    }

                    LoginServer.putLoginAuth(playerid, (String)ip.one, (String)ip.two, (Integer)ip.three, (String)ip.four);
                }

                c.setTempIP((String)ip.two);
                c.setChannel((Integer)ip.three);
                player = MapleCharacter.loadCharFromDB(playerid, c, true);
            } else {
                player = MapleCharacter.ReconstructChr(transfer, c, true);
                firstLoggedIn = false;
            }

            slea.skip(3);
            long sessionId = slea.readLong();
            ChannelServer channelServer = c.getChannelServer();
            c.setPlayer(player);
            c.setSessionId(sessionId);
            if (sessionId != c.getSessionId()) {
                c.disconnect(true, false);
            } else {
                c.setAccID(player.getAccountID());
                if (!c.CheckIPAddress()) {
                    String msg = "检测连接地址不合法 服务端断开这个连接 [角色ID: " + player.getId() + " 名字: " + player.getName() + " ]";
                    c.getSession().close();
                    log.info(msg);
                } else {
                    int state = c.getLoginState();
                    boolean allowLogin = false;
                    String allowLoginTip = null;
                    if (state == 1 || state == 3 || state == 0) {
                        List charNames = c.loadCharacterNames(c.getWorld());
                        allowLogin = !World.isCharacterListConnected(charNames);
                        if (!allowLogin) {
                            allowLoginTip = World.getAllowLoginTip(charNames);
                        }
                    }

                    int ch = WorldFindService.getInstance().findChannel(player.getId());
                    if (ch != -10 && ch != -20) {
                        if (!allowLogin) {
                            String msg = "检测账号下已有角色登陆游戏 服务端断开这个连接 [角色ID: " + player.getId() + " 名字: " + player.getName() + " ]\r\n" + allowLoginTip;
                            c.setPlayer((MapleCharacter)null);
                            c.登录账号断开在线角色(player.getAccountID());
                            channelServer.removePlayer(player);
                            c.disconnect(true, false);
                            c.getSession().close();
                            log.info(msg);
                        } else {
                            c.初始化DesKey(bytes, playerid);
                            c.updateLoginState(2, c.getSessionIPAddress());
                            channelServer.addPlayer(player);
                            player.initAllInfo();
                            player.setLogintime(System.currentTimeMillis());
                            c.announce(MaplePacketCreator.cancelTitleEffect());
                            player.giveCoolDowns(PlayerBuffStorage.getCooldownsFromStorage(player.getId()));
                            player.silentGiveBuffs(PlayerBuffStorage.getBuffsFromStorage(player.getId()));
                            player.giveSilentDebuff(PlayerBuffStorage.getDiseaseFromStorage(player.getId()));
                            Iterator var17 = MapleQuest.GetBulbQuest().iterator();

                            while(var17.hasNext()) {
                                MapleQuest ss = (MapleQuest)var17.next();
                                MapleQuestStatus marr1 = c.getPlayer().getQuestNAdd(ss);
                                if (marr1 != null && marr1.getStatus() == 0) {
                                    marr1.setStatus((byte)2);
                                }
                            }

                            int[] buddyIds = GameConstants.autoCompletQuest;
                            int var40 = buddyIds.length;

                            int i;
                            int var44;
                            for(var44 = 0; var44 < var40; ++var44) {
                                i = buddyIds[var44];
                                MapleQuestStatus questNAdd = c.getPlayer().getQuestNAdd(MapleQuest.getInstance(i));
                                if (questNAdd != null) {
                                    questNAdd.setStatus((byte)2);
                                }
                            }

                            MapleQuestStatus stat;
                            if (JobConstants.is爆莉萌天使(player.getJob())) {
                                stat = player.getQuestNAdd(MapleQuest.getInstance(7707));
                                MapleQuestStatus marr1 = player.getQuestNAdd(MapleQuest.getInstance(29015));
                                if (stat != null && marr1 != null && stat.getStatus() == 0 && marr1.getStatus() == 0) {
                                    stat.setStatus((byte)1);
                                    marr1.setStatus((byte)1);
                                }
                            }

                            if (JobConstants.is神之子(player.getJob())) {
                                stat = player.getQuestNAdd(MapleQuest.getInstance(40905));
                                if (stat != null && stat.getStatus() == 0) {
                                    stat.setStatus((byte)2);
                                }
                            }

                            c.getPlayer().checkNameLevel();
                            c.getPlayer().initSigninStatus();
                            c.getPlayer().initOnlineTime();
                            c.getPlayer().initTransWarpTicket();
                            c.getPlayer().getHyPay(1);
                            c.announce(MaplePacketCreator.getWarpToMap(player, firstLoggedIn));
                            c.announce(MaplePacketCreator.ShowAranCombo(0));
                            c.announce(MaplePacketCreator.changeHour(3, Calendar.getInstance().get(11)));
                            c.announce(MaplePacketCreator.sendloginSuccess());
                            c.announce(MaplePacketCreator.updateMount(player, false));
                            c.announce(MaplePacketCreator.getKeymap(player));
                            c.announce(MaplePacketCreator.getQuickSlot(player.getQuickSlot()));
                            player.updatePetAuto();
                            c.announce(SigninPacket.showSigninUI());
                            if (!player.containsInfoQuest(16700, "date=" + (new SimpleDateFormat("yyyyMMdd")).format(new Date()))) {
                                player.updateInfoQuest(16700, "count=300;date=" + (new SimpleDateFormat("yyyyMMdd")).format(new Date()));
                            }

                            player.sendMacros();
                            c.announce(MaplePacketCreator.showCharCash(player));
                            c.announce(MaplePacketCreator.reportResponse((byte)0, 0));
                            c.announce(MaplePacketCreator.enableReport());
                            int skillid;
                            if (player.isIntern()) {
                                buddyIds = new int[]{9001004, 1010};
                                int[] var42 = buddyIds;
                                var44 = buddyIds.length;

                                for(i = 0; i < var44; ++i) {
                                    skillid = var42[i];
                                    Optional.ofNullable(SkillFactory.getSkill(skillid)).ifPresent((skillx) -> {
                                        skillx.getEffect(1).applyTo(player);
                                    });
                                }
                            }

                            player.getMap().addPlayer(player);

                            try {
                                buddyIds = player.getBuddylist().getBuddyIds();
                                WorldBuddyService.getInstance().loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
                                MapleParty party = player.getParty();
                                if (party != null) {
                                    WorldPartyService.getInstance().updateParty(party.getPartyId(), PartyOperation.LOG_ONOFF, new MaplePartyCharacter(player));
                                    if (party.getExpeditionId() > 0) {
                                        MapleExpedition me = WorldPartyService.getInstance().getExped(party.getExpeditionId());
                                        if (me != null) {
                                            c.announce(PartyPacket.expeditionStatus(me, false));
                                        }
                                    }
                                }

                                CharacterIdChannelPair[] onlineBuddies = WorldFindService.getInstance().multiBuddyFind(player.getId(), buddyIds);
                                CharacterIdChannelPair[] var50 = onlineBuddies;
                                skillid = onlineBuddies.length;

                                for(int var22 = 0; var22 < skillid; ++var22) {
                                    CharacterIdChannelPair onlineBuddy = var50[var22];
                                    player.getBuddylist().get(onlineBuddy.getCharacterId()).setChannel(onlineBuddy.getChannel());
                                }

                                c.announce(BuddyListPacket.updateBuddylist(player.getBuddylist().getBuddies()));
                                c.announce(BuddyListPacket.updateBuddylistEnd());
                                MapleMessenger messenger = player.getMessenger();
                                if (messenger != null) {
                                    WorldMessengerService.getInstance().silentJoinMessenger(messenger.getId(), new MapleMessengerCharacter(player));
                                    WorldMessengerService.getInstance().updateMessenger(messenger.getId(), player.getName(), c.getChannel());
                                }

                                if (player.getGuildId() > 0) {
                                    WorldGuildService.getInstance().setGuildMemberOnline(player.getMGC(), true, c.getChannel());
                                    c.announce(GuildPacket.showGuildInfo(player));
                                    MapleGuild gs = WorldGuildService.getInstance().getGuild(player.getGuildId());
                                    if (gs != null) {
                                        List packetList = WorldAllianceService.getInstance().getAllianceInfo(gs.getAllianceId(), true);
                                        if (packetList != null) {
                                            Iterator var57 = packetList.iterator();

                                            while(var57.hasNext()) {
                                                byte[] pack = (byte[])var57.next();
                                                if (pack != null) {
                                                    c.announce(pack);
                                                }
                                            }
                                        }
                                    } else {
                                        player.setGuildId(0);
                                        player.setGuildRank((byte)5);
                                        player.setAllianceRank((byte)5);
                                        player.saveGuildStatus();
                                    }
                                }

                                if (player.getFamilyId() > 0) {
                                    WorldFamilyService.getInstance().setFamilyMemberOnline(player.getMFC(), true, c.getChannel());
                                }

                                c.announce(FamilyPacket.getFamilyData());
                                c.announce(FamilyPacket.getFamilyInfo(player));
                            } catch (Exception var27) {
                                log.error("加载好友、家族错误", var27);
                            }

                            player.getClient().announce(MaplePacketCreator.serverMessage(channelServer.getServerMessage()));
                            player.showNote();
                            player.sendImp();
                            if (player.checkSoulWeapon()) {
                                c.announce(BuffPacket.giveSoulGauge(player.getSoulCount(), player.getEquippedSoulSkill()));
                            }

                            player.updatePartyMemberHP();
                            player.startFairySchedule(false);
                            player.baseSkills();
                            player.expirationTask();
                            player.morphLostTask();
                            if (player.getJob() == 132) {
                                player.checkBerserk();
                            }

                            player.spawnSavedPets();
                            if (player.getStat().equippedSummon > 0) {
                                Skill skill = SkillFactory.getSkill(player.getStat().equippedSummon);
                                if (skill != null) {
                                    skill.getEffect(1).applyTo(player);
                                }
                            }

                            player.getCheatTracker().getLastlogonTime();
                            stat = player.getQuestNoAdd(MapleQuest.getInstance(122700));
                            c.announce(MaplePacketCreator.pendantSlot(stat != null && stat.getCustomData() != null && Long.parseLong(stat.getCustomData()) > System.currentTimeMillis()));
                            c.announce(InventoryPacket.modifyInventory());
                            String rank = player.getOneInfo(18771, "rank");
                            if (rank != null) {
                                player.getMapleUnion().setRank(Integer.valueOf(rank));
                                player.updateOneQuestInfo(18771, "rank", rank);
                                player.getMapleUnion().update();
                                c.announce(MaplePacketCreator.UpdateMapleUnion(player.getMapleUnion()));
                            }

                            if (firstLoggedIn) {
                                if (player.getLevel() == 1) {
                                    player.dropMessage(1, "欢迎来到 " + c.getChannelServer().getServerName() + ", " + player.getName() + " ！\r\n使用 @help 可以查看您当前能使用的命令\r\n祝您玩的愉快！");
                                    player.dropMessage(5, "使用 @help 可以查看您当前能使用的命令 祝您玩的愉快！");
                                    player.gainExp(500L, true, false, true);
                                } else {
                                    player.dropSpouseMessage(10, "[系统提示] 如果发现宠物不捡取道具，请打开角色装备栏 - 宠物 - 拾取道具 打上勾。");
                                }

                                if (c.getChannelServer().getDoubleExp() == 2) {
                                    player.dropSpouseMessage(20, "[系统提示] 当前服务器处于双倍经验活动中，祝您玩的愉快！");
                                }

                                c.announce(MaplePacketCreator.showPlayerCash(player));
                                if (player.getJob() == 6001 && player.getLevel() < 10) {
                                    while(player.getLevel() < 10) {
                                        player.gainExp(5000L, true, false, true);
                                    }
                                }

                                NPCScriptManager.getInstance().start(c, 9900003, "PlayerLogin");
                            }

                            c.announce(InventoryPacket.getInventoryStatus());
                            player.AutoCelebrityCrit();
                            if (JobConstants.is豹弩游侠(player.getJob())) {
                                c.announce(MaplePacketCreator.updateJaguar(c.getPlayer()));
                                StringBuilder stringBuilder = new StringBuilder();

                                for(i = 1; i <= 9; ++i) {
                                    stringBuilder.append(i).append("=1");
                                    if (i != 9) {
                                        stringBuilder.append(";");
                                    }
                                }

                                c.announce(MaplePacketCreator.updateInfoQuest(23008, stringBuilder.toString()));
                            }

                            if (JobConstants.is剑豪(c.getPlayer().getJob())) {
                                SkillFactory.getSkill(40011291).getEffect(1).applyTo(c.getPlayer());
                            } else if (JobConstants.is尖兵(c.getPlayer().getJob())) {
                                c.getPlayer().startPower();
                            } else if (JobConstants.is夜行者(c.getPlayer().getJob()) && c.getPlayer().getLevel() >= 60) {
                                SkillFactory.getSkill(14110030).getEffect(1).applyTo(c.getPlayer());
                            }
                            player.checkAutoAtkType();
                            player.fixOnlineTime();
                            List starRewards = StarReward.getInstance().getStarRewardInfo(player.getId());
                            if (starRewards.size() > 0) {
                                player.dropMessage(1, "礼物奖励\r\n你有奖励道具未领取，请点击左边的星星找到奖励进行领取。");
                                player.send(RewardPacket.StarRewardInfo(starRewards));
                            }
                            c.announce(FamiliarPacket.UpdateFamiliarFalg(player));
                            player.send(UIPacket.ShowSupportUI());
                        }
                    } else {
                        player.ban("疑似刷物品操作", false, true, false);
                        log.info("疑似刷物品操作,无法登录游戏");
                    }
                }
            }
        }

        /*     */   }
    /*     */
    /*     */   public static void ChangeChannel(LittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {
        /* 538 */     if (chr == null || chr.hasBlockedInventory() || chr.getEventInstance() != null || chr.getMap() == null || chr.isInBlockedMap() || FieldLimitType.ChannelSwitch.check(chr.getMap().getFieldLimit())) {
            /* 539 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /* 542 */     if (chr.isBanned()) {
            /* 543 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /* 546 */     if (chr.getAntiMacro().inProgress()) {
            /* 547 */       chr.dropMessage(5, "被使用测谎仪时无法操作。");
            /* 548 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /* 551 */     int chc = slea.readByte() + 1;
        /* 552 */     if (!World.isChannelAvailable(chc)) {
            /* 553 */       chr.dropMessage(1, "该频道玩家已满，请切换到其它频道进行游戏。");
            /* 554 */       c.announce(MaplePacketCreator.enableActions());
            /*     */       return;
            /*     */     }
        /* 557 */     chr.changeChannel(chc);
        /*     */   }
    /*     */
    /*     */   public static void ChangePlayer(LittleEndianAccessor slea, MapleClient c) {
        /* 562 */     char[] ss = new char[256];
        /* 563 */     int i = 0;
        /* 564 */     while (i < ss.length) {
            /* 565 */       int f = (int)(Math.random() * 3.0D);
            /* 566 */       if (f == 0) {
                /* 567 */         ss[i] = (char)(int)(65.0D + Math.random() * 26.0D);
                /* 568 */       } else if (f == 1) {
                /* 569 */         ss[i] = (char)(int)(97.0D + Math.random() * 26.0D);
                /*     */       } else {
                /* 571 */         ss[i] = (char)(int)(48.0D + Math.random() * 10.0D);
                /*     */       }
            /* 573 */       i++;
            /*     */     }
        /* 575 */     String key = new String(ss);
        /* 576 */     LoginServer.pubLoginAuthKey(key, c.getAccountName(), c.getChannel());
        /* 577 */     c.announce(LoginPacket.changePlayerKey(key));
        /*     */   }
    /*     */ }

